package com.hongdee.crm.mainReportForm.controller;

import com.hongdee.base.entity.ResultEntity;
import com.hongdee.common.util.DateUtils;
import com.hongdee.crm.mainReportForm.service.IMainReportFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by My on 2017/4/5.
 */
@RestController
@RequestMapping("/crm/mainReport")
public class MainReportFormController {
    @Autowired
    private IMainReportFormService iMainReportFormService;

    /**
     * @param uid   登录用户id
     * @param token 登录用户 token
     * @return Map
     * @throws Exception
     * @desc 当月产值和昨日产值
     * @author 术洪超
     */
    @RequestMapping("/realCount")
    @ResponseBody
    public ResultEntity monRealCount(@RequestParam(name = "uid", defaultValue = "") String uid,
                                     @RequestParam(name = "token", defaultValue = "") String token) throws Exception {
        ResultEntity res = new ResultEntity();
        List list = this.iMainReportFormService.realCount(uid);
        res.setData(list);
        res.setSuccess(true);
        res.setMsg("查询详情成功");
        return res;
    }


    /**
     * @param uid   登录用户id
     * @param token 登录用户 token
     * @return Map
     * @throws Exception
     * @desc 半年维修产值分析
     * @author 术洪超
     */
    @RequestMapping("/maintainRealCount")
    @ResponseBody
    public ResultEntity maintainRealCount(@RequestParam(name = "uid", defaultValue = "") String uid,
                                          @RequestParam(name = "token", defaultValue = "") String token) throws Exception {
        ResultEntity res = new ResultEntity();
        Map map = this.iMainReportFormService.maintainRealCount(uid);
        res.setData(map);
        res.setSuccess(true);
        res.setMsg("查询详情成功");
        return res;
    }

    /**
     * @param uid   登录用户id
     * @param token 登录用户 token
     * @return Map
     * @throws Exception
     * @desc 半年进厂分析
     * @author 术洪超
     */
    @RequestMapping("/intoCount")
    @ResponseBody
    public ResultEntity into(@RequestParam(name = "uid", defaultValue = "") String uid,
                             @RequestParam(name = "token", defaultValue = "") String token) throws Exception {
        ResultEntity res = new ResultEntity();
        Map map = this.iMainReportFormService.intoCount(uid);
        res.setData(map);
        res.setSuccess(true);
        res.setMsg("查询详情成功");
        return res;
    }

    /**
     * @param uid   登录用户id
     * @param token 登录用户 token
     * @return Map
     * @throws Exception
     * @desc 基盘客户和活跃度
     * @author 术洪超
     */
    @RequestMapping("/base")
    @ResponseBody
    public ResultEntity baseCount(@RequestParam(name = "uid", defaultValue = "") String uid,
                                  @RequestParam(name = "token", defaultValue = "") String token) throws Exception {
        ResultEntity res = new ResultEntity();
        List list = this.iMainReportFormService.base(uid);
        res.setData(list);
        res.setSuccess(true);
        res.setMsg("查询详情成功");
        return res;
    }

}
